<?php
define("JL", 1);

@session_start();
// Includes obligatorios
include_once ('./dbconfig.php');
include_once ('./administration/Libraries/Tools/JLTools.class.php');
$jl = JLTools::getInstance();

$ip = getIpAddress();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR" lang="fr-FR" >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta name="robots" content="index, follow" />
        <meta name="google-site-verification" content="l6Fc4-_RGKeL_0Y8H7wAhDHge8ORqjoSkWeN2WQQzrU" />
        <meta name="generator" content="LBN | Design &amp; Development Studio" />
        <title>Actualités CSME</title>
        <link href="js/lib/flexslider.css" rel="stylesheet" type="text/css" media="screen, projection" />
        <link href="base.css" rel="stylesheet" type="text/css" media="all" />
        <link href="slider/stylesheets/slider-popup.css" rel="stylesheet" type="text/css" media="screen, projection" />
        <link href="js/lib/xpopup/xpopup-1.0.css" rel="stylesheet" type="text/css" media="screen, projection" />
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script>!window.jQuery && document.write(unescape('%3Cscript src="js/lib/jquery-1.7.1.min.js"%3E%3C/script%3E'))</script>
        <link rel="stylesheet" href="slider/stylesheets/coda-slider-2.0.css" type="text/css" media="screen" />
        <script type="text/javascript" src="slider/javascripts/jquery.coda-slider-2.0_update.js"></script>
        <script type="text/javascript" src="slider/javascripts/jquery.easing.1.3.js"></script>
        <script type="text/javascript" src="js/lib/xpopup/xpopup.min-1.0.js"></script>
        <script type="text/javascript" src="js/lib/jquery.xvalidator-1.0.min.js"></script>
        <script type="text/javascript" src="js/lib/jquery.cookie.min.js"></script>
        <script type="text/javascript" src="js/lib/jquery.flexslider-min.js"></script>
        <script type="text/javascript" src="js/lib/utils-1.0.min.js"></script>
        <script type="text/javascript" src="js/lib/jquery.tooltip.min.js"></script>
        <script type="text/javascript" src="administration/?act=required"></script>

        <!--[if IE]>
        <style>.submitimagehidden{ margin-left:160px; margin-top:43px; }</style>
        <![endif]-->
        <!--[if IE 7]>
        <link href="base-ie7.css" rel="stylesheet" type="text/css" media="screen, projection" charset="utf-8" />
        <![endif]-->
        <link rel="shortcut icon" href="favicon.ico" />
        <link rel="alternate" type="application/rss+xml" title="CSME Actualitès - RSS Feed" href="http://feed.csme.fr/" />
    </head>
    <body>
        
        <?php include 'modules/annonce.html.php'; ?>

        <div id="button_top">
            <a href="javascript:;"><img src="images/arrow_top.png" width="18" height="25" />
                <span id="top">TOP <br /><strong>SITE</strong></span></a>
        </div>

        <div id="main-container">

            <!-- BN-TOP -->
            <div id="bn-top" class="bxshd">    

                <!-- MENU-TOP -->
                <div class="menu-top">
                    
                    <div id="logo">
                        <a href="./" title="CSME Club Sportif Multisections d'Epinay-sur-Seine"><img alt="CSME LOGO" src="images/csme-logo.png" width="174" height="159" /></a>
                    </div>

                    <!-- NEWSLETTER -->
                    <div id="newsletter" class="bxshd">
                        <div class="newscenter">
                            <div class="newscontent">
                                <h3><img src="images/sobre.png" width="16" height="12" /> Newsletter</h3>
                                <div class="subtitle">Inscrivez-vous à notre newsletter.</div>
                                <div><form action="./" method="post" enctype="application/x-www-form-urlencoded" name="frmnewsletter" id="frmnewsletter">
                                        <input name="txtnom" type="text" class="txtnewsletter" id="txtnom" autocomplete="off" />
                                        <label id="email">
                                            <input name="txtemail" type="text" class="txtnewsletter" id="txtemail" autocomplete="off" />
                                            <input class="valid" type="submit" value="OK" onfocus="this.blur();" />
                                        </label>
                                    </form>
                                </div>



                                <div id="partenaires">

                                    <div class="face_fb_plugin"><a title="Suivez-nous sur facebook" target="_blank" href="http://www.facebook.com/CSMEpinaysurSeine"></a></div>
                                    <div class="text_fb_plugin">Soyez le premier parmi vos amis.
                                        <br />Rejoignez-nous vite !
                                    </div>
                                    <div class="fb_like_plugin">
                                        <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FCSME-Club-Sportif-Multisections-dEpinay-sur-Seine%2F176399182395742&amp;layout=button_count&amp;locale=fr_FR&amp;show_faces=false&amp;width=170&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:170px; height:21px;" allowTransparency="true"></iframe>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- END NEWSLETTER -->


                    <!-- MENU -->
                    <ul>
                        <li><a class="link" title="Accueil" href="./"  target="_parent">Accueil</a></li>
                        <li><a class="link" title="Présentation" href="presentation.html"  target="_parent">Présentation</a></li>
                        <li><a class="link" title="Les sections" target="_parent" id="les_sections_id">Les sections</a>

                            <?php
                            include_once 'modules/menu.html.php';
                            printMenu($select);
                            ?>

                        </li>
                        <li><a class="link selected" title="Actualités" href="actualites.html" target="_parent">Actu. CSME</a></li>
                        <li><a class="link" title="Administration" href="administration.html" target="_parent">Administration</a></li>
                        <li><a class="link" title="Contact" href="contacts.html" target="_parent">Contact</a></li>
                    </ul>
                    <!-- END MENU-->


                </div>
                <!-- END MENU-TOP -->


            </div>
            <!-- END BN-TOP -->


            <!-- BN-CONTENT-->
            <div id="bn-content">

                <!-- BN CONTENT TEXT -->
                <div class="bn-content-text bxshd">
                    <div class="bn-ct-top"></div>
                    <table border="0" cellpadding="0" cellspacing="0" class="bn-ct-repeat">
                        <tr>
                             <td class="bn-ct-r-center">
                                <div class="bn-ct-r-center-menu">
                                    <div class="bn-menu-title">
                                        <div class="bn-menu-icon"></div>
                                        <h1 title="Actualités CSME">Actu. CSME</h1>
                                    </div>
                                </div>

                                <div class="coda-slider preload" id="coda-slider-1">

                                    <?php
                                    $SQL = "SELECT 
					  var_monthyear
					FROM 
					  tbl_actualites
					WHERE int_id_section < 3 && int_id_section !=0 && int_id_state != 3
					GROUP BY var_monthyear
					ORDER BY int_actualite DESC
                                        LIMIT 400";

                                    $res = mysql_query($SQL, $cnn);

                                    while ($row = mysql_fetch_assoc($res)) {
                                        $SQL2 = "SELECT 
                                          tbl_actualites.int_actualite,
                                          tbl_actualites.var_ac_title,
                                          tbl_actualites.txt_content_actualite,
                                          tbl_actualites.dat_creation_act,
                                          tbl_actualites.int_vote,
                                          tbl_actualites.txt_image_galleries,
                                          tbl_sections.var_desc_section
                                        FROM
                                          tbl_sections 
                                          INNER JOIN tbl_actualites ON (tbl_sections.int_id_section = tbl_actualites.int_id_section)
                                        WHERE int_id_state <> 3 AND var_monthyear = '" . $row['var_monthyear'] . "' AND tbl_sections.int_id_section < 3 
                                        ORDER BY int_actualite DESC
                                        LIMIT 600";

                                        $ress = mysql_query($SQL2);
                                        $t = mysql_num_rows($ress);
                                        if ($t <= 0) {
                                            continue;
                                        }
                                        ?>

                                        <div class="panel">
                                            <div class="panel-wrapper">
                                                <h2 class="title">
                                                    <?php echo $row['var_monthyear']; ?><div class="sub-line title"></div>
                                                </h2>
                                                <?php
                                                $i = 1;
                                                while ($row2 = mysql_fetch_assoc($ress)) {
                                                    $idactualite = $row2['int_actualite'];
                                                    ?>
            <!--                                                    <a class="no-link" id="act<?php echo $idactualite; ?>" name="act<?php echo $idactualite; ?>" href="javascript:;">&nbsp;</a>-->
                                                    <p class="sub-title" id="act<?php echo $idactualite; ?>" name="act<?php echo $idactualite; ?>">
                                                        <span class="vote">
                                                            <?php
                                                            $sql = "SELECT chr_ip FROM tbl_visiteur
                                                            WHERE int_actualite = " . $idactualite . " AND chr_ip = '" . $ip . "'";
                                                            $resvote = mysql_query($sql);
                                                            if (mysql_num_rows($resvote) == 0) {
                                                                ?>
                                                                <span class="icon" xval="<?php echo $idactualite; ?>">J'aime !</span>
                                                            <?php } ?>
                                                            <span class="count"><strong><?php echo $row2['int_vote']; ?></strong></span>
                                                        </span>

                                                        <?php echo $row2['dat_creation_act']; ?>
                                                    </p>
                                                    <p class="sub-title2">Section: <strong style="font-weight:bold;"><?php echo $row2['var_desc_section']; ?></strong></p>
                                                    <p class="title-act"><strong style="font-weight:bold;"><?php echo $row2['var_ac_title']; ?></strong></p>
                                                    <div class="sub-content"><?php echo $row2['txt_content_actualite']; ?></div>


                                                    <?php
                                                    $galleries = $row2['txt_image_galleries'];

                                                    if (!empty($galleries)):
                                                        $galleries = unserialize($galleries);
                                                        if (is_array($galleries)) :
                                                            ?>
                                                            <div class="actualite-galleries">
                                                                <?php
                                                                foreach ($galleries as $id) :
                                                                    $sql = "SELECT 
                                                                        tbl_gallery.var_title_gallery,
                                                                        tbl_gallery.var_image_reference,
                                                                        tbl_gallery.bol_admin,
                                                                        tbl_gallery.int_viewed,
                                                                        tbl_sections.int_id_section
                                                                    FROM tbl_sections
                                                                    INNER JOIN tbl_gallery ON (tbl_sections.int_id_sections_view = tbl_gallery.int_id_sections_view)
                                                                    WHERE int_id_gallery = $id
                                                                    LIMIT 1";
                                                                    $resg = mysql_query($sql);
                                                                    $rowg = mysql_fetch_assoc($resg);
                                                                    $title = $rowg['var_title_gallery'];
                                                                    if (str_word_count($title) > 1):
                                                                        $parts = explode(' ', $title);
                                                                        $title = str_replace($parts[1], $parts[1] . '<br />', $title);
                                                                    endif;

                                                                    if ($rowg['bol_admin'] == 1):
                                                                        ?>
                                                                        <a href="administration.html?album=<?php echo $id; ?>">
                                                                            <div class="photo-actu">
                                                                                <div class="detail">
                                                                                    <h3><?php echo $title; ?></h3>
                                                                                    <strong>Vu<br /><span><?php echo $rowg['int_viewed']; ?></span> fois</strong>
                                                                                </div>
                                                                                <span class="background"></span>
                                                                                <img src="galeries/gallery-reference/<?php echo $rowg['var_image_reference']; ?>" width="218" height="136" />
                                                                            </div>
                                                                        </a>
                                                                        <?php
                                                                    else :
                                                                        $id_section = $rowg['int_id_section'] - 2;
                                                                        ?>
                                                                        <a href="section.html?id=<?php echo $id_section; ?>&amp;album=<?php echo $id; ?>">
                                                                            <div class="photo-actu">
                                                                                <div class="detail">
                                                                                    <h3><?php echo $title; ?></h3>
                                                                                    <strong>Vu<br /><span><?php echo $rowg['int_viewed']; ?></span> fois</strong>
                                                                                </div>
                                                                                <span class="background"></span>
                                                                                <img src="galeries/gallery-reference/<?php echo $rowg['var_image_reference']; ?>" width="218" height="136" />
                                                                            </div>
                                                                        </a>
                                                                    <?php
                                                                    endif;
                                                                    $i++;
                                                                endforeach;
                                                                ?>
                                                            </div>
                                                            <?php
                                                        endif;
                                                    endif;


//                                                    if ($t != $i) {
                                                    ?>
                                                    <div class="sub-line"></div>
                                                    <?php
//                                                    }
                                                    $i++;
                                                }
                                                ?> 
                                            </div>
                                        </div>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <div class="fldbtm"></div>                    
                </div>
                <!-- END CONTENT TEXT -->


                <div id="push"></div>

            </div>
            <!-- BN-CONTENT-->

        </div>


        <?php
        include 'modules/footer.html.php';
        printFooter($cnn);
        printTooltips($cnn);
        ?>

        <script type="text/javascript" src="js/js-main.js"></script>
        <script type="text/javascript" src="js/slider-actualites.js"></script>

        <?php printAutoScroll($ip); ?>
        <?php
        printMyVisites();
        @mysql_close();
        ?>
    </body>
</html>